package conf
import (
	"github.com/spf13/viper"
	"go.uber.org/zap"
)

// GrpcSection map toml [grpc]
type GrpcSection struct {
	Host string
	Port string
	MaxReboot int `mapstructure:"int"`
}

// ReadGRPC get grpc section from config
func ReadGRPC (v *viper.Viper, slog *zap.SugaredLogger) (grpcConf GrpcSection) {
	err := v.Unmarshal(&grpcConf)
	if err != nil {
		slog.Panicf("unable to decode into grpc section, %v", err)
	}
	slog.Debug(grpcConf)
	return
}